import request from "@/utils/requset.js";

export const apis = {
  add: (data) => {
    return request({
      url: "/preventionHiddenRegister/create",
      method: "post",
      data: data,
    });
  },
  addV2: (data) => {
    return request({
      url: "/preventionHiddenRegister/createAbnormal",
      method: "post",
      data: data,
    });
  },
  addV3: (data) => {
    return request({
      url: "/preventionHiddenRegister/createHiddenAbnormal",
      method: "post",
      data: data,
    });
  },
  query: (params) => {
    return request({
      url: "/preventionHiddenRegister/list",
      method: "get",
      params,
    });
  },
  querydj: (params) => {
    return request({
      url: "/preventionHiddenRegister/listdj",
      method: "get",
      params,
    });
  },
  del: (row) => {
    return request({
      url: "/preventionHiddenRegister/delete",
      method: "get",
      params: {
        id: row.id,
      },
    });
  },
  update: (data) => {
    return request({
      url: "/preventionHiddenRegister/update",
      method: "post",
      data: data,
    });
  },
  detail: (data) => {
    return request({
      url: "/preventionHiddenRegister/" + data,
      method: "get",
    });
  },
  updateRectification: (data) => {
    return request({
      url: "/preventionHiddenRegister/updateRectification",
      method: "post",
      data: data,
    });
  },
  updateReview: (data) => {
    return request({
      url: "/preventionHiddenRegister/updateReview",
      method: "post",
      data: data,
    });
  },
  updateTaskState: (data) => {
    return request({
      url: "/preventionCheckTask/updateTaskState",
      method: "post",
      data: data,
    });
  },
  zz: (params) => {
    return request({
      url: "/preventionDevice/list",
      method: "get",
      params,
    });
  },
  governHiddenInventoryAdd: (data) => {  // 录入隐患
    return request({
      url: "/check/governHiddenInventory",
      method: "post",
      data
    });
  },
  getHiddenDetail: (hiddenInventoryId) => {  // 隐患详情
    return request({
      url: `/check/governHiddenInventory/${hiddenInventoryId}`,
      method: "get"
    });
  },
  getHiddenRepair: (data) => {  // 隐患整改
    return request({
      url: "/check/governHiddenInventory/repair",
      method: "post",
      data
    });
  },
  getHiddenReview: (data) => {  // 隐患复核
    return request({
      url: "/check/governHiddenInventory/review",
      method: "post",
      data
    });
  },
  editHidden: (data) => {  // 编辑隐患
    return request({
      url: "/check/governHiddenInventory",
      method: "put",
      data
    });
  },
  getHiddenSource: (params) => {  // 隐患来源
    return request({
      url: "/check/governDict/getHiddenSource",
      method: "get",
      params,
    });
  },
  getHiddenType: (params) => {  // 隐患类型
    return request({
      url: "/check/governDict/getHiddenType",
      method: "get",
      params,
    });
  },
  getWeiHaiType: (params) => {  // 危害类型
    return request({
      url: "/check/governDict/getWeiHaiType",
      method: "get",
      params,
    });
  },
  getCheckTaskItemList: (params) => {  // 查询检查项
    return request({
      url: '/check/governCheckTaskItem/list',
      method: "get",
      params
    });
  },
  getCheckTaskItemScore: (params) => {  // 查询【检查项】扣分规则
    return request({
      url: `/check/governCheckTaskItemScore/get/${params}`,
      method: "get"
    });
  },
  // 修改检查计划子任务项状态
  fixCheckTaskItemStatus: (data) => {
    return request({
      url: "/check/governCheckTaskPlanItem",
      method: "put",
      data: data
    });
  }
};
